home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.3 / Video Toaster v4.3.iso / 3.1 / toasterall / arexx_examples / stopframe.rexx < prev    next >
OS/2 REXX Batch file  |  1993-06-06  |  3KB  |  79 lines

  1. /* StopFrame.rexx  Grabs frames on cue from GPI trigger for stop-action animation */
  2. /* By Arnie Cachelin © 1992 NewTek Inc. */
  3.  
  4. /*
  5.     This program will grab and save frames on cue from the GPI trigger.
  6.     If you enter a number to grab, it will save that many then exit.
  7.     Otherwise, 3 frames will be saved, then the prog. will exit.  Since
  8.     the Toaster is waiting for GPI input most of the time, it will not
  9.     respond  to anything else, which you may find annoying.  You can easily
  10.     give  your Toaster GPI pulses by attaching a spare mouse or joystick to
  11.     the second mouse port then clicking the button.  You can also find long
  12.     joystick extender cables at places like Radio Shack.
  13.  
  14.     To grab frames for a claymation of stop-motion style animation, setup your
  15.     camera and 'actors', hook up a GPI trigger, and start this script with
  16.     appropriate arguments.  When your first frame is ready, hit the trigger
  17.     to grab and save it.  The toaster will then go into an 'onionskin' mode
  18.     where the camera is half dissolved over the last frame for ease of
  19.     positioning the actors.  When you hit the GPI again, the Toaster will leave
  20.     onionskin mode and grab the next frame, then return to onionskin mode.
  21.  
  22.     For best results, watch out for stray shadows, or shadows from the sun which
  23.     will change over the course of your shoot.
  24. */
  25.  
  26. OPTIONS RESULTS
  27. parse arg count name startframe
  28.  if count="" then count=3
  29.     if startframe="" then startframe=0
  30. TOASTERLIB="ToasterARexx.port"
  31.  
  32. IF ~SHOW('Libraries',TOASTERLIB) THEN
  33.   IF ~ADDLIB(TOASTERLIB , 0) THEN say "Please start your Toaster"
  34.  
  35. say "Saving "count" frames as "name
  36. Switcher(TOSW)        /* Go to Switcher screen */
  37. if ~Switcher(CKGD,A48) then Switcher(GRID,A11)   /* Select Fade in getsmall */
  38. else Switcher(GRID,A48)
  39. Switcher(P001)
  40. Switcher(LVID)
  41. Switcher(PDV1)
  42. Switcher(P001)
  43. Switcher(SGPI,POS)    /* Set GPI trigger to positive (leading edge of pulse) */
  44. Switcher(WAIT,GPI)    /* Wait for GPI trigger to come in for first frame */
  45. Do i=startframe to startframe+count-1
  46.   Switcher(FVID)        /* Freeze frame */
  47.   Frame=right(trim(i),3,"0")
  48.   if name="" then c=SaveNextFrame("grab") /* Save into Framestore if no name */
  49.   else do /* Or Save RGBs into path/name specified */
  50.         fname =strip(name)||right(i,3,'0')
  51.     say  fname
  52.     call Switcher(SRGB,fname,0,5)
  53.     end
  54.   Switcher(P001)
  55.   Switcher(MDV1)
  56.   Switcher(TBAR,255)
  57.   Switcher(WAIT,GPI)    /* Wait for GPI trigger to come in */
  58.   Switcher(AUTO)
  59.   Switcher(LVID)        /* Set to live digital video */
  60.     Switcher(PDV1)
  61.   Switcher(P001)
  62.     Switcher(FRES)
  63.   Switcher(WAIT,60)  
  64. end
  65. Switcher(TOWB)        /* Go to Workbench screen */
  66.  
  67. exit
  68.  
  69. SaveNextFrame:  Procedure
  70.   arg name
  71.   N=Switcher(STAT,KNUM)       /* Get the current keypad number */
  72.   fs=N+1
  73.   do while Switcher(FMXI,fs) & fs~=N  /* Is the frame already there? */
  74.     if fs=999 then fs=0       /* wrap around at last frame */
  75.     else fs=fs+1
  76.   end
  77.   if fs=N then t=10        /* got to starting frame without finding open fs */
  78.   else t=Switcher(FMSV,fs,name)    /* Save frame */
  79.   return t